/*
 * @Description: 作业题
 * @Author: rendc
 * @Date: 2025-03-10 09:17:06
 * @LastEditors: rendc
 * @LastEditTime: 2025-03-10 10:16:14
 */

public class HomeWorkTest {

  public static void main(String[] args) {
    int c = 2000000000 + 2000000000; // 精度丢失
    long d = 2000000000 + 2000000000; // 精度丢失
    long dL = 2000000000L + 2000000000L; // 精度丢失?
    int a = 2000000000;
    long e = a + a;
    System.out.println("a:" + a);
    System.out.println("e:" + e);
    System.out.println("c:" + c);
    System.out.println("d:" + d);
    System.out.println("dL:" + dL);
    long d5 = 999999999;
    System.out.println("d5:" + d5);
    long e6 = 9999999999L;
    System.out.println("e6:" + e6);
    // 每天的毫秒数
    int ms = 24 * 60 * 60 * 1000;
    System.out.println("ms:" + ms);
    // 每天的微秒数 超过int类型范围 应该转换为long类型
    long us = 24 * 60 * 60 * 1000 * 1000L;
    System.out.println("us:" + us);
    short s = 1;// int>sort
    System.out.println("s:" + s);
    s = (short) (s + 2); // short + int = int 需要强制类型转换
    // 0.01 + 1 1.01
    System.out.println("s:" + s);
    short x = 1;
    x += 2; // x = (short)(x + 2);
    // 复合的赋值运算符+=会自动将表达式结果转换为被赋值变量的类型
    System.out.println("x:" + x);
    int a1;
    int b1 = 6;
    a1 = b1--;
    System.out.println(a1); // 6
    System.out.println(b1); // 5

    int b = 5;
    if (b > 4) {
      System.out.println("b第一次:" + b);
    } else {
      b--;
      System.out.println("b第二次:" + b);
    }
    // 1 b=5 b>4 true 输出b=5
    // 2 b=5 输出b=5

    int b2 = 5;
    if (b2 > 4) {
      b2--;
      System.out.println("b2⼤于4");
    } else {
      System.out.println("b2不⼤于4");
    }
    // 1. b2=5 5>4 true b2=4 输出b2⼤于4
    // 无循环，只输出一次 for while 2. b2=4 4=4 false 输出b2不⼤于4
  }
}